package com.action.link;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.business.link.LinkBus;
import com.config.SystemGlobals;

public class UpdateLink extends HttpServlet {

	private static final long serialVersionUID = 1L;

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		String contentType = SystemGlobals.getValue("contentType");
		PrintWriter out = response.getWriter();
		response.setContentType(contentType);
		String action = request.getParameter("action");
		String linkNo = request.getParameter("no");
		if ("del".equals(action)) {
			LinkBus lb = new LinkBus();
			lb.del(linkNo);
			out
					.println("<script>alert(\"删除成功\");window.location=\"user/linklist.jsp\";</script>");
		}
		if ("edit".equals(action)) {
			RequestDispatcher rd = request
					.getRequestDispatcher("user/editlink.jsp?no=" + linkNo);
			rd.forward(request, response);
		}

	}

}
